<template>
  <div class="home-page">
    <!-- banner轮播图 -->
    <Swiper class="home-swiper" />
    <!-- 关于我们 -->
    <About />
    <!-- 兴宁文旅 -->
    <BoutiqueRecommend />
    <!-- 名人推荐 -->
    <ArtistRecomm />
    <!-- 线上视频 -->
    <OnlineVideo />
    <!-- 数字展览 -->
    <ArtGallery />
    <!-- 行业动态 -->
    <Dynamic />
  </div>
</template>

<script>
import Swiper from "./component/swiper";
import About from "./component/about";
import BoutiqueRecommend from "./component/boutiqueRecommend";
import ArtistRecomm from "./component/artistRecomm";
import OnlineVideo from "./component/onlineVideo.vue";
import ArtGallery from "./component/artGallery.vue";
import Dynamic from "./component/dynamic.vue";

export default {
  scrollToTop: true,
  loading: true,
  layout: "index",
  name: "Home",
  components: {
    Swiper,
    About,
    BoutiqueRecommend,
    ArtistRecomm,
    OnlineVideo,
    ArtGallery,
    Dynamic,
  },
  data() {
    return {
      menuTop: [],
    };
  },
  async asyncData({ $api }) {
    const res = await $api.getProductType({});
    if (res.status == "$SUCCESS") {
      return {
        menuTop: Array.isArray(res.result.item_list) ? res.result.item_list.filter((item) => item.parent_id == -1) : [],
      };
    }
    const response = await $api.artWorkList({});

    return {};
    // $api.getMenu({}).then(res => {
    //   console.log('res', res)
    // }).catch(err => {
    //   console.log(err)
    // })
  },
  created() {
    // if (process.browser) {
    //   let {
    //     BasicDraw,
    //     ModelShowroom,
    //     PanoramaShowroom,
    //     BigImageShow, // 大图类
    //   } = require("../../utils/main");

    //   // 显示大图 new BigImageShow().showBigImg(大图id)

    //   let basicDraw = new BasicDraw(); // 创建基础渲染类
    //   basicDraw.start(); // 开始渲染

    //   let model = new ModelShowroom("1001401", true, {
    //     // 创建3D模型展厅并渲染，参数：展厅ID、是否调试、基础请求配置
    //     ak: "mt4edffc3f519ce730ee5e51c6faf4c3df",
    //   });

    //   let btn = document.createElement("button");
    //   btn.textContent = "释放";
    //   btn.style = `
    //     position: absolute;
    //     z-index:1002;
    //     top:0;
    //     left:0;
    //   `;
    //   btn.onclick = (e) => {
    //     // 必须释放！！！
    //     model.dispose(); // 先释放展厅
    //     basicDraw.dispose(); // 再释放渲染类
    //     e.stopPropagation();
    //   };
    //   document.body.append(btn);
    // }
  },
  mounted() {},
};
</script>

<style lang="less" scoped>
.home-page {
  background: #fff;
}
</style>
